const express = require('express');
const router = express.Router();

router.get('/forCurrentUser', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        code: 'string',
        dealerCode: 'string',
        dealerName: 'string',
        claimType: 2,
        claimPartType: 2,
        actualCompensationWay: 1,
        actualTransportType: 1,
        saleShipmentCode: 'string',
        batchNumber: 'string',
        urgencyLevel: 2,
        status: 1,
        createTime: '2020-03-24T07:08:12.562Z',
        rowVersion: 'string',
        options: [
            'update',
            'approve',
            'submit',
            'abandon',
            'firstapprove',
            'partclaim',
            'reason',
            'upgrade',
            'laborhourclaim'
        ]
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 40,
        }
    });
});
router.get('/:id', (req, res) => {
    res.json(
        {
            message: 'string',
            payload: {
                id: '1',
                code: 'string',
                dealerCode: 'string',
                dealerName: 'string',
                claimType: 2,
                claimPartType: 2,
                actualCompensationWay: 1,
                actualTransportType: 1,
                saleShipmentId: 'string',
                saleShipmentCode: 'string',
                batchNumber: 'string',
                urgencyLevel: 2,
                status: 1,
                createTime: '2020-03-24T07:08:12.562Z',
                rowVersion: 'string',
                brandId: 'string',
                brandCode: 'string',
                brandName: 'string',
                dealerId: 'string',
                country: 'string',
                contactNumber: 'string',
                requireCompensationWay: 1,
                requireTransportType: 2,
                containerNumber: 'string',
                boxNumber: 'string',
                caseNumber: 'string',
                bLNumber: 'string',
                bLDate: '2020-03-24T07:19:20.629Z',
                description: 'string',
                remark: 'string',
                approverName: 'string',
                approveTime: '2020-03-24T07:19:20.629Z',
                approveComment: 'string',
                creatorName: 'string',
                modifierName: 'string',
                modifyTime: '2020-03-24T07:19:20.629Z',
                submitterName: 'string',
                submitTime: '2020-03-24T07:19:20.629Z',
                judgerName: 'string',
                judgerTime: '2020-03-24T07:19:20.629Z',
                assayerName: 'string',
                assayTime: '2020-03-24T07:19:20.629Z',
                discussantName: 'string',
                discussTime: '2020-03-24T07:19:20.629Z',
                abandonerName: 'string',
                abandonTime: '2020-03-24T07:19:20.629Z',
                options: [
                    'update',
                    'approve',
                    'firstapprove',
                    'submit',
                    'abandon',
                    'partclaim',
                    'reason',
                    'upgrade',
                    'laborhourclaim'
                ],
                claimDetails: [
                    {
                        fileId: '001',
                        fileName: 'fileName001'
                    }
                ],
                shippingDetails: [
                    {
                        fileId: '001',
                        fileName: 'fileName001'
                    }
                ],
                details: [
                    {
                        id: '1',
                        kdBomCode: 'string',
                        quantity: 5,
                        dutyUnitId: 'string',
                        dutyUnitCode: 'string',
                        dutyUnitName: 'string',
                        productCategoryId: 'string',
                        productCategoryCode: 'string',
                        productCategoryName: 'string',
                        engineModel: 'string',
                        transmissionModel: 'string',
                        engineCode: 'string',
                        transmissionSn: 'string',
                        vehicleFrameCode: 'string',
                        mfgIsClaim: true,
                        mfgComment: 'string',
                        planIsClaim: true,
                        planComment: 'string',
                        qualityIsClaim: true,
                        qualityComment: 'string',
                        partDetails: [
                            {
                                id: 1,
                                detailId: '1',
                                quantity: 1,
                                shipPartId: 'string',
                                shipPartCode: 'string',
                                shipPartName: 'string',
                                partAfterId: 'string',
                                partCodeAfter: 'string',
                                partNameAfter: 'string',
                                isFromKDBOM: 1,
                                isSubPart: 2,
                                supplierCode: 'string'
                            }
                        ]
                    }
                ],
            }
        }
    );
});

router.get('/forSaleProformaInvoice', (req, res) => {
    const content = [];
    for(let i = 0; i < 20; i++)
        content.push({
            id: `2020${i}`,
            code: `2020${i}`,
            brandId: `00${i}`,
            brandCode: 'brandCode',
            brandName: 'brandName',
            dealerId: '001',
            dealerCode: 'dealerCode',
            dealerName: 'dealerName',
            claimType: 2,
            compensationWay: 1,
            saleShipmentCode: 'saleShipmentCode',
            batchNumber: 'batchNumber',
            urgencyLevel: 2,
            status: 1,
            createTime: '2020-02-24T07:28:14.058Z'
        });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 20,
        }
    });
});

router.get('/detail/forSaleProformaInvoice', (req, res) => {
    const details = [];
    for(let i = 0; i < 5; i++)
        details.push({
            id: `2020${i}`,
            code: `code${i}`,
            kdBomCode: `kDBomCode${i}`,
        });
    res.json({
        message: '',
        payload: {
            details,
            totalElements: 5,
        }
    });
});

router.put('/:id', (req, res) => {
    res.json({
        message: '编辑成功'
    });
});
router.put('/:id/approve', (req, res) => {
    res.json({
        message: '审核成功'
    });
});
router.put('/:id/partclaim', (req, res) => {
    res.json({
        message: '零件赔付'
    });
});
router.put('/:id/reason', (req, res) => {
    res.json({
        message: '原因分析'
    });
});
router.put('/:id/upgrade', (req, res) => {
    res.json({
        message: '升级讨论'
    });
});
router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});
router.put('/:id/submit', (req, res) => {
    res.json({
        message: '提交成功'
    });
});
module.exports = router;
